"""
    	1.9+99+999+9999+...+999999999 求和
"""

print("方法一:------------------------")

# n就是要累加的数字
n = input("Enter Number")
# c就是要累加的次数
c = int(input("Enter Count"))
sm = 0
for i in range(c):
    sm += int(n)
    n += n[0]
print("sum : {}".format(sm))


print("方法二:------------------------")

n = 9
sm = 0
# 9 + 99 + 999
for i in range(9):
    sm = sm + n
    n = n * 10 + 9
print("sum : {}".format(sm))


print("方法三:------------------------")
sm = 0
for i in range(1,10):
    sm += (10 ** i) - 1
print("sum : {}".format(sm))












